package com.ruoyi.quartz.race;

import org.springframework.stereotype.Component;

import com.github.pagehelper.util.StringUtil;
import com.ruoyi.quartz.race.init.ServiceHistory;
import com.ruoyi.quartz.race.init.ServiceTouzhu;
import com.ruoyi.quartz.race.init.ServiceTrend;
import com.ruoyi.quartz.race.stock.StockUtil;
import com.ruoyi.quartz.race.type.ServiceDc;
import com.ruoyi.quartz.race.type.ServiceJc;
import com.ruoyi.quartz.race.type.ServiceZc;

import us.codecraft.webmagic.Spider;

/**
 * 定时任务调度测试
 */
@Component("raceTask")
public class RaceTask {
	public void jcTask(String params) {
		String url = "https://live.500.com";

		if (StringUtil.isNotEmpty(params)) {
			url = url + "?e=" + params;
		}
		Spider.create(new ServiceJc()).addUrl(url).run();
	}

	public void dcTask(String params) {
		String url = "https://live.500.com/zqdc.php";

		if (StringUtil.isNotEmpty(params)) {
			url = url + "?e=" + params;
		}
		Spider.create(new ServiceDc()).addUrl(url).run();
	}

	public void zcTask(String params) {
		String url = "https://live.500.com/zucai.php";

		if (StringUtil.isNotEmpty(params)) {
			url = url + "?e=" + params;
		}
		Spider.create(new ServiceZc()).addUrl(url).run();
	}

	public void rjTrend(String params) {
		ServiceTrend.process(params);
	}

	public void rjTouzhu(String params) {
		ServiceTouzhu.process(params);
	}

//	public void backHistory() {
//		ServiceHistory.backup();
//	}

	public void stock() {
		StockUtil.process();
	}
}
